fn main() {
    let mut str = String::from("内容");

    str.push_str("内容");
    println!("{}", str);

    println!("=====字符串合并=====");
    {
        let mut s1 = String::from("hello");
        let mut s2 = String::from(", world");
        let mut s3 = s1 + &*s2;
        // println!("s1={}", s1);
        println!("s2={}", s2);
        println!("s3={}", s3);
    }

    println!("=====格式化字符串=====");
    {
        let mut str1 = String::from("aa");
        let mut str2 = String::from("bb");
        let mut str3 = String::from("cc");
        let mut str = format!("{}-{}-{}", str1, str2, str3);
        println!("str={}", str);
    }

    println!("=====字符串切片=====");
    {
        let mut s = String::from("hello world");

        println!("Hello={}", &s[0..5]);
        println!("Hell={}", &s[..4]);
    }

    println!("=====遍历字符串=====");
    {
        let mut str = String::from("你好");

        println!("=====遍历字符串 - 字符=====");
        for item in str.chars(){
            println!("item={}",item);
        }

        println!("=====遍历字符串 - bytes=====");
        for item in str.bytes(){
            println!("item={}",item);
        }
    }

}
